w<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
	String gd_id = request.getParameter("gd_id") == null ? "" : request.getParameter("gd_id");
	String worker_id = request.getParameter("worker_id") == null ? "" : request.getParameter("worker_id");
    String gd_worker_name = request.getParameter("gd_worker_name") == null ? "" : request.getParameter("gd_worker_name");
    String gd_worker_person = request.getParameter("gd_worker_person") == null ? "" : request.getParameter("gd_worker_person");
%>
<html>
	<head>
		<title>更换工单部门</title>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.tdg{
			padding-top:10px;
			padding-bottom:5px;
			font-size: 12px;
			background-color: #c0ebd7;
			width:20%;
		}
		.tdb{
			padding:5px;
			width:30%;
		}
		</style>
   		 
		<script type="text/javascript">
	$(function(){
	jQuery("#searchValue1").keypress(function(e) { 
			    	// 回车键事件 
			     	if(e.which == 13) { 
			     		 doSearch1();
			       	} 
			   	}); 
		var typeArr=new Array("内部班组","外部分包商");
				$('#gd_worker_id').combogrid({
					idField:"id",
					textField:"worker_company",
					title:'分包商资料',
					panelWidth:550,
					panelHeight:400,
					rownumbers:true,
					url:'<%=contextPath%>/springMVC/crm/listPageWorker',
					loadMsg:'正在加载数据，请稍后......',
					fitColumns:true,
					frozenColumns:[[
					    {title:'主键',field:'id',hidden:true}
					]],
					columns:[[
						{title:'分包商类别',field:'type_id',width:200,align:'center',formatter:function(value,rowData,rowIndex){
							return typeArr[rowData.type_id];
						}},
						{title:'公司名称',field:'worker_company',width:200,align:'center'},
						{title:'负责人',field:'worker_person',width:200,align:'center'},
						{title:'联系方式',field:'contact',width:200,align:'center'}
					]],
					pageSize:10,
					pageList : [10,50,100],  
					pagination:true,
					toolbar:'#tb1',
					onChange:function(){
						var row = jQuery('#gd_worker_id').combogrid("grid").datagrid('getSelected');
						jQuery('#gd_worker_person').val(row.worker_person);
					},
					onLoadSuccess:function(rtJson){
						jQuery('#gd_worker_id').combogrid('setValue',fbId);
						jQuery('#gd_worker_id').combogrid('setText',fbName);
					}
				});
		 })
			function doSubmit(obj){
				  var gd_worker_name = $('#gd_worker_id').combogrid('getText');
				  var gd_worker_person = $('#gd_worker_person').val();
				$.messager.confirm('确认','您确认要变更分包名称吗？请仔细核实！',function(msg){
				if(msg){
					jQuery("#fm").form('submit',{
						url:"<%=contextPath %>/springMVC/gd/updateWorkerBg?gd_id=<%=gd_id%>&gd_worker_id=<%=worker_id%>&gd_worker_name="+gd_worker_name+"&gd_worker_person="+gd_worker_person,
						onSubmit:function(){
							var isValid = jQuery(this).form('validate');
							if(isValid){
								jQuery(obj).hide();
							}
							return isValid;
						},
						success:function(rtJson){
							rtJson = eval('(' + rtJson + ')'); 
							if (rtJson.rtState == '0'){
								warningInfo(rtJson.rtMsrg);
								eval('window.opener.rtCallBack();');
								window.close();
								
							}else{
								jQuery(obj).show();
								warningInfo(rtJson.rtMsrg);
							}
						}
					});
				}
			})
		}
    function doSearch1() {
	var searchValue = jQuery('#searchValue1').val();
	var type_id = jQuery('#type_id').val();
	jQuery('#gd_worker_id').combogrid("grid").datagrid('load', {
		searchValue : searchValue,
		type_id : type_id
	});
}
		</script>
	</head>
	<body onload="setContent();">
			<div style="width: 97%;padding-left:10px">
	
							<form id="fm"  method="post">
							<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">			
		      				<tr>
								<td align="right" class="td1" nowrap>班组名称：</td>
								<td class="td2" nowrap>
									<input  id="gd_old_worker_name" name="gd_worker_name" disabled="disabled" value="<%=gd_worker_name%>">
								</td>
								<td align="right" class="td1" nowrap>班组负责人：</td>
								<td class="td2" nowrap>
								<input  id="gd_old_worker_person" name="gd_worker_person" disabled="disabled" value="<%=gd_worker_person%>">
								</td>
							</tr>
							<tr>
									<td align="right"  nowrap class="td1">
										班组名称：
									</td>
									<td class="td2" nowrap >
										<input type="text" id="gd_worker_id" name="gd_worker_id"  data-options="required:true">
									</td>
									<td align="right"  nowrap class="td1">
										班组负责人：
									</td>
									<td class="td2" nowrap >
										<input type="text" id="gd_worker_person" name="gd_worker_person"  class="easyui-validatebox" data-options="required:true">
									</td>
								</tr>
					   		   <tr>
								<td align="right" nowrap class="td1">
								</td>
								<td  nowrap colspan="3">
									<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:false" onclick="doSubmit(this);">保存</a>
									<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:false" onclick="javascript:window.close();">关闭</a>
								</td>
							</tr>
				 			</table>
				 			</form>
			</div>	
			 	<div id="tb1" style="padding:3px;height:auto">
			<div align="right">
				分类：<select id="type_id" class="" name="type_id"  onchange="doSearch1()">   
					     <option value="" selected></option> 
					    <option value="0">内部班组</option>   
					    <option value="1">外部分包商</option>   
					</select>  
				查询条件：<input id="searchValue1" name="searchValue1" style="width:150px" title="分包商名称或负责人"/>&nbsp;&nbsp;
				<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch1();"></a>
			</div>
		</div>			 		
	</body>
</html>


